Native Animated - Support events using RCT{Direct|Bubbling}EventBlock on iOS#15611
Native Animated - Support events using RCT{Direct|Bubbling}EventBlock on iOS#15611janicduplessis wants to merge 2 commits into
Conversation
|
@facebook-github-bot label Core Team Attention: @janicduplessis, @shergin Generated by 🚫 dangerJS |
shergin
left a comment
There was a problem hiding this comment.
Looks like two great PR mixed up here. 😄
| - (instancetype)initWithName:(NSString *)name viewTag:(NSNumber *)viewTag arguments:(NSArray *)arguments | ||
| { | ||
| self = [super init]; | ||
| if (self) { |
| ); | ||
| } | ||
|
|
||
| /** |
|
@shergin Updated |
|
@janicduplessis this is awesome! Looking forward for this! |
|
@janicduplessis What does |
|
@shergin Ok I understand why you are confused :) Not sure why it is called INPUT event because afaik it has nothing to do with inputs, I just kept the current naming. So when using RCTDirectEventBlock to create a view manager prop it ends up here https://github.com/facebook/react-native/blob/master/React/Views/RCTComponentData.m#L242 then createEventSetter will create a block that calls into |
|
And the other part of the PR is to deal with the event name normalization that is done in sendInputEventWithName (https://github.com/facebook/react-native/blob/master/React/Base/RCTEventDispatcher.m#L91) |
|
OMG, now I know how RCTDirectEvent works. Almost. Thanks! |
|
@shergin 👍 Let me know if you need more context on anything else. |
|
@janicduplessis Could you please help me figure out why this was named |
|
@shergin From doing a quick search looks like it is only used in There is also |
|
@janicduplessis I just want to know that we know what we are doing. And do the right things. 😄 |
|
@shergin Ok, I had a better look at that code and it should be possible to switch to using only I can put up a PR tomorrow to remove |
|
@janicduplessis Great! Do you mean remove |
|
I think we can get rid of it completely and always use sendEvent |
|
@shergin Removed Also simplified dealing with non-coalescable events by automatically generating a coalescingKey is |
|
Also this should probably be split in 2 PRs, just wanted to keep it here for now but once we're happy with a solution I'll make a new PR for the removal of |
|
@janicduplessis @shergin any news here? What is needed to proceed with this pr? |
| event.viewTag.intValue | | ||
| (((uint64_t)event.eventName.hash & 0xFFFF) << 32) | | ||
| (((uint64_t)event.coalescingKey) << 48) | ||
| (((uint64_t)([event canCoalesce] ? event.coalescingKey : RCTNonCoalescableEventKey++)) << 48) |
There was a problem hiding this comment.
We access optional canCoalesce and coalescingKey here.
So, we have two options here:
- Do
responseToSelectorcheck here. - Make that props required for all implementations.
I strongly prefer 2 because we should maintain this function as perfromant as possible.
Right?
There was a problem hiding this comment.
Oh, no, I see, I am wrong.
|
@janicduplessis Okay, we will be back to this PR after landing of #15894. Right? |
|
@shergin Yep, then I will rebase this PR on top of the event improvements |
|
@janicduplessis I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
|
@janicduplessis thanks a lot for your previous effort on this PR. It would enable really nice native animations with RN. This become stale for more a couple of month now. Any change to get this going? |
0726310 to
c2f72e3
Compare
Generated by 🚫 dangerJS against 5967a1d75c7c6ee87ab93c8464d1550c3cad29b3 |
|
@shergin Rebased and tested it still works :) |
|
What's the status of this PR? |
5967a1d to
4fe14cf
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This pull request was successfully merged by @janicduplessis in 083f835. When will my fix make it into a release? | Upcoming Releases |
|
Had to revert this because of: Could you send it again with this fixed? |
When calling a prop of type
RCTDirectEventBlockorRCTBubblingEventBlockit uses a completely different code path than events using[RCTEventDispatcher sendEvent:]and those were not dispatched to theRCTEventDispatcherListeners. We also do some event name normalization which caused issues between the JS and native event names. To fix that I simply remove the parts we normalize from the event key.Changelog:
[iOS] [Fixed] - Support events using RCT{Direct|Bubbling}EventBlock
Test plan:
Added a Slider (it used RCTBubblingEventBlock for it's onValueChange event) that can control a native animated value in RNTester to reproduce the bug and made sure this diff fixes it.